import React, {Component} from 'react';
import {CSS} from './styles/dialog.css';

export default class Dialog extends Component {
    constructor(props) {
        super(props);
        this.closeDialog = this.closeDialog.bind(this);
    }

    closeDialog(e) {
        e.stopPropagation();
        e.preventDefault();
        this.props.close();
    }
    render() {
        return (
            <div>
                {this.props.show ?
                    <div>
                        <div className="dialogMask"></div>
                        <div className="dialogBox">
                            <div className="closeDialog" onClick={this.closeDialog}><img src="/iot-meeting/assets/images/meetingRoom/close.png" placeholder="关闭"/></div>

                            {this.props.children}
                        </div>

                    </div>
                    : ""}
            </div>
        );
    }
};

Dialog.propTypes = {
    title: React.PropTypes.string,
    show: React.PropTypes.bool,
    close : React.PropTypes.func,
};
